package cn.xinfei.xdecision.engine.runner.vo;

import cn.xinfei.xdecision.common.model.enginex.model.RuleHitModel;
import cn.xinfei.xdecision.common.model.enginex.model.RuleSetDecisionResultData;
import cn.xinfei.xdecision.constant.EngineResultEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.context.annotation.Primary;

import java.util.List;
import java.util.Map;

@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = false)
public class EngineApiResponse {

    private String engineCode;
    private String requestId;
    private String decisionId;
    private String result;
    private String state;
    private String code;
    private String msg;
    private long respond;
    private Map<String, Object> out;
    private List<RuleHitModel> hitResultList;
    private List<RuleSetDecisionResultData> branchRejectInfo;

    public EngineApiResponse() {
    }

    public EngineApiResponse(EngineResultEnum engineResultEnum) {
        this.state = engineResultEnum.getState();
        this.code = engineResultEnum.getCode();
        this.msg = engineResultEnum.getMsg();
        this.result = engineResultEnum.getResult();
    }

    public void setEngineResult(EngineResultEnum engineResultEnum) {
        this.state = engineResultEnum.getState();
        this.code = engineResultEnum.getCode();
        this.msg = engineResultEnum.getMsg();
        this.result = engineResultEnum.getResult();
    }
}
